﻿using System.Collections.Generic;
using Algoritmia.DataStructures.Digraphs;

namespace Algoritmia.Problems.ShortestPaths
{
    public interface IMinimumDistanceFinder<TNode,TResult> 
    {
        TResult SomeToSomeDistance(IDigraph<TNode> g, WeightingFunction<TNode, TResult> d,
                                 IEnumerable<TNode> sources, IEnumerable<TNode> targets);
    }

    public static class MinimumDistanceFindersExtensions
    {
        public static TResult Distance<TNode, TResult>(this IShortestPathsFinder<TNode, TResult> pf, IDigraph<TNode> g, WeightingFunction<TNode, TResult> d, TNode source, TNode target)
        {
            return pf.SomeToSomeDistance(g, d, new[] { source }, new[] { target });
        }
    }
}
